import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:mybase/base/tool/empty/FFEmpty.dart';
import 'package:mybase/base/tool/extension/FFSliverExt.dart';
import 'package:mybase/base/tool/platformUtils/FFPlatform.dart';

class FFScreenValue {}

Size globalScreenSize(BuildContext context) {
  return MediaQuery
      .of(context)
      .size;
}

double globalScreenWidth(BuildContext context) {
  return MediaQuery
      .of(context)
      .size
      .width;
}

double globalScreenHeight(BuildContext context) {
  return MediaQuery
      .of(context)
      .size
      .height;
}

EdgeInsets globalScreenPadding(BuildContext context) {
  return MediaQuery
      .of(context)
      .padding;
}

double globalScreenPaddingTop(BuildContext context) {
  return MediaQuery
      .of(context)
      .padding
      .top;
}

double globalScreenPaddingBottom(BuildContext context) {
  double bottom = MediaQuery
      .of(context)
      .padding
      .bottom;
  return bottom;
}

/// 底部安全区域
double globalBottomSafeArea(BuildContext context, {double scale = 1.0,}) {
  if (FFPlatform.isIOS) {
    return globalScreenPaddingBottom(context) * scale;
  } else if (FFPlatform.isAndroid) {
    return 16 * scale;
  }
  return 16 * scale;
}

Widget globalBottomWidget(BuildContext context) {
  return Container(
    height: globalBottomSafeArea(context),
  );
}

Widget globalBottomWidgetToSliver(BuildContext context) {
  return Container(
    height: globalBottomSafeArea(context),
  ).toSliverBox;
}

// 自定义的tabbar高
double globalTabbarHeight({double percent = 1.0}) {
  return kBottomNavigationBarHeight + 24 * percent;
}
